package com.geline.luckysheet.controller;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.AllArgsConstructor;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * 下载Excel实体类定义
 * @author: mengxin
 * @date: 2022/10/12 15:21
 */
@Data
@AllArgsConstructor
public class ExcelDemo implements Serializable {

    @ColumnWidth(5)
    @ExcelProperty(index = 0, value = "序号")
    private Integer number;

    /**
     * 将姓名指定为excel的第一列，表头为value
     */
    @ColumnWidth(30)
    @ExcelProperty(index = 1, value = "姓名")
    private String name;

    /**
     * 将年龄指定为excel的第二列，表头为value
     */
    @ColumnWidth(10)
    @ExcelProperty(index = 2, value = "年龄")
    private Integer age;

    /**
     * 将生日指定为第三列，表头为value，日期格式指定为'dd/MM/yyyy HH:mm:ss'
     */
    @ColumnWidth(15)
    @ExcelProperty(index = 3, value = "生日")
    @DateTimeFormat("yyyy-MM-dd")
    private Date birthday;
}
